{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "835be985",
   "metadata": {},
   "outputs": [],
   "source": [
    "from qiskit import QuantumCircuit, qasm3\n",
    "from quantum_chip import QuantumChip\n",
    "from hardware import HardwareParams\n",
    "from compiler import TimeAwareCompiler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2657328d",
   "metadata": {},
   "outputs": [],
   "source": [
    "quantum_circuit: QuantumCircuit = qasm3.load(\n",
    "    # 从qasm文件中加载电路\n",
    "    \"./circuits/qaoa_30.qasm\"\n",
    ")\n",
    "# quantum_circuit.draw(output=\"mpl\", filename=\"./output/qaoa_10.png\")\n",
    "quantum_chip = QuantumChip(\n",
    "    # square / hexagon / heavy_square / heavy_hexagon\n",
    "    \"square\",\n",
    "    10\n",
    ")\n",
    "hardware_param = HardwareParams(\n",
    "    time_1q=50.0,  # 单比特门时间\n",
    "    time_2q=300.0,  # 双比特门时间\n",
    "    time_meas=4000.0,  # 测量时间\n",
    "    time_reset=1000.0,  # 重置时间\n",
    ")\n",
    "# quantum_chip.visualize()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "f29f4081",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'QRMapCompiler' object has no attribute 'schedule'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[3], line 3\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mqrmap_compiler\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m QRMapCompiler\n\u001b[1;32m      2\u001b[0m qmc \u001b[38;5;241m=\u001b[39m QRMapCompiler(quantum_circuit, quantum_chip, hardware_param)\n\u001b[0;32m----> 3\u001b[0m \u001b[43mqmc\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mschedule\u001b[49m()\n\u001b[1;32m      4\u001b[0m \u001b[38;5;28mprint\u001b[39m(quantum_circuit\u001b[38;5;241m.\u001b[39mdepth())\n",
      "\u001b[0;31mAttributeError\u001b[0m: 'QRMapCompiler' object has no attribute 'schedule'"
     ]
    }
   ],
   "source": [
    "from qrmap_compiler import QRMapCompiler\n",
    "qmc = QRMapCompiler(quantum_circuit, quantum_chip, hardware_param)\n",
    "qmc.schedule()\n",
    "print(quantum_circuit.depth())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
